package com.white.hot.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.white.hot.dto.resp.BaseResp;

@Controller
@RequestMapping("/live")
public class LiveController extends BaseController
{
	private String currentUrl;
	
	@RequestMapping("/push")
	@ResponseBody
	private Object varify(@RequestParam("url") String url, HttpServletRequest request, final HttpServletResponse response)
	{
		currentUrl = url;	
		System.out.println(currentUrl);
		BaseResp br = new BaseResp();
		return buildSuccessResp(br);
	}
	
	@RequestMapping("/retrive")
	private void retrive(@RequestParam("seed") String seed, HttpServletRequest request, final HttpServletResponse response)
	{
		System.out.println(seed);
	}
	
	@RequestMapping("/get")
	@ResponseBody
	private Object getLiveUrl(HttpServletRequest request, final HttpServletResponse response)
	{
		BaseResp br = new BaseResp();
		br.setInfo(currentUrl);
		br.setStatus("ok");
		return br;
	}
}
